package com.ruoyi.swimming.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.swimming.domian.SwimmingTicketType;
import com.ruoyi.swimming.domian.SwimmingTicketWriteOff;
import com.ruoyi.swimming.mapper.SwimmingTicketTypeMapper;
import com.ruoyi.swimming.mapper.SwimmingTicketWriteOffMapper;
import com.ruoyi.swimming.service.ISwimmingTicketWriteOffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 泳池核销流水单Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-07-17
 */
@Service
public class SwimmingTicketWriteOffServiceImpl extends ServiceImpl<SwimmingTicketWriteOffMapper, SwimmingTicketWriteOff> implements ISwimmingTicketWriteOffService
{
    @Autowired
    private SwimmingTicketWriteOffMapper swimmingTicketWriteOffMapper;

    /**
     * 查询泳池核销流水单
     * 
     * @param id 泳池核销流水单ID
     * @return 泳池核销流水单
     */
    @Override
    public SwimmingTicketWriteOff selectSwimmingTicketWriteOffById(Long id)
    {
        return swimmingTicketWriteOffMapper.selectSwimmingTicketWriteOffById(id);
    }

    /**
     * 查询泳池核销流水单列表
     * 
     * @param swimmingTicketWriteOff 泳池核销流水单
     * @return 泳池核销流水单
     */
    @Override
    public List<SwimmingTicketWriteOff> selectSwimmingTicketWriteOffList(SwimmingTicketWriteOff swimmingTicketWriteOff)
    {
        return swimmingTicketWriteOffMapper.selectSwimmingTicketWriteOffList(swimmingTicketWriteOff);
    }

    /**
     * 新增泳池核销流水单
     * 
     * @param swimmingTicketWriteOff 泳池核销流水单
     * @return 结果
     */
    @Override
    public int insertSwimmingTicketWriteOff(SwimmingTicketWriteOff swimmingTicketWriteOff)
    {
        swimmingTicketWriteOff.setCreateTime(DateUtils.getNowDate());
        return swimmingTicketWriteOffMapper.insert(swimmingTicketWriteOff);
    }

    /**
     * 修改泳池核销流水单
     * 
     * @param swimmingTicketWriteOff 泳池核销流水单
     * @return 结果
     */
    @Override
    public int updateSwimmingTicketWriteOff(SwimmingTicketWriteOff swimmingTicketWriteOff)
    {
        swimmingTicketWriteOff.setUpdateTime(DateUtils.getNowDate());
        return swimmingTicketWriteOffMapper.updateById(swimmingTicketWriteOff);
    }

    /**
     * 批量删除泳池核销流水单
     * 
     * @param ids 需要删除的泳池核销流水单ID
     * @return 结果
     */
    @Override
    public int deleteSwimmingTicketWriteOffByIds(Long[] ids)
    {
        return swimmingTicketWriteOffMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除泳池核销流水单信息
     * 
     * @param id 泳池核销流水单ID
     * @return 结果
     */
    @Override
    public int deleteSwimmingTicketWriteOffById(Long id)
    {
        return swimmingTicketWriteOffMapper.deleteById(id);
    }
}
